home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Cache Computing / DCon DEMO 1.0 / DCon SDK 1.0 / DCon SDK ReadMe
Encoding:
Text File  |  1998-11-10  |  3.6 KB  |  108 lines  |  [ttro/ttxt]

  1. DCon - “The Ultimate Debugging Console”
  2. ©1998 Phasic Interware, © 1998 Cache Computing
  3. http://www.cache-computing.com/products/dcon
  4. mailto:dcon@cache-computing.com
  5.  
  6.  
  7.  
  8.  
  9.  
  10. Function - dopen
  11.  
  12.      void dopen(const char *log);
  13.  
  14. Description
  15.  
  16. The dopen function redirects the output from the dprintf, vdprintf and dprintmem functions to the log file named the its c-style string argument.  A value of NULL may be specified to redirect output back to the console window.  Note, a non-obvious side affect of redirecting output to a log file is that it will no longer be displayed in the console window unless the 'Echo log files to console' preference is checked.
  17.  
  18. Examples
  19.  
  20. To redirect all dprintf, vdprintf and dprintmem output to the file "MyApp.log":
  21.      dopen("MyApp.log");
  22.  
  23. To redirect all dprintf, vdprintf and dprintmem output back to the console window:
  24.      dopen(NULL);
  25.  
  26.  
  27.  
  28.  
  29.  
  30. Function - dprintf, dfprintf, vdprintf, vdfprintf
  31.  
  32.      void dprintf(const char *format, ...);
  33.      void dfprintf(const char *log, const char *format, ...);
  34.      void vdprintf(const char *format, va_list arg);
  35.      void vdfprintf(const char *log, const char *format, va_list arg);
  36.  
  37. Description
  38.  
  39. The dprintf family of functions produces output according to a c-style format string.  The format string specifies how subsequent arguments (or arguments accessed via the variable-length argument facilities of stdarg for vdprintf and vdfprintf) are converted into output.  The functions dprintf and vdprintf write output to the console window. The functions dfprintf and vdfprintf write output to the log file named by the first c-style string argument.
  40.  
  41. Examples
  42.  
  43. To output a pascal string and print its length to the log file named "debug.log":
  44.      StringPtr pstr = "\pHello World!";
  45.      dfprintf("debug.log","%#s contains %d chars\n", pstr, pstr[0]);
  46.  
  47. To output a date and time in the form "Sunday, July 3, 10:02", where weekday and month are pointers to c-style strings and day, hour and min are integers:
  48.      dprintf("%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min);
  49.  
  50.  
  51.  
  52.  
  53.  
  54. Function - dprintmem, dfprintmem
  55.  
  56.      void dprintmem(const void *data,size_t len);
  57.      void dfprintmem(const char *log,const void *data,size_t len);
  58.  
  59. Description
  60.  
  61. The dprintmem family of function outputs a formatted hexadecimal and ASCII dump of a block of memory.
  62.  
  63. Examples
  64.  
  65. To dump the first 16 bytes of the System Heap as raw data:
  66.      dprintmem((Ptr)0x2800,16);
  67.  
  68.      Displaying 16 bytes from 00002800
  69.      00002800  00AF 9B60 009B B7E0  0069 6730 0012 79B0  '...`.....ig0..y.'
  70.  
  71.  
  72.  
  73.  
  74.  
  75. Macro - DCON
  76.  
  77.      #define DCON 0
  78.      #define DCON 1
  79.  
  80. Description
  81.  
  82. The DCON macro allows the C preprocessor to strip all DCon function calls out of compiled code.  The default behavior is to include DCon function calls, by adding a #define DCON 0 before inclusion of the DCon.h header file all DCon function calls will be converted into statements that produce no runtime code.  The default behavior of the DCON macro can be altered by change its value in the DCon.h header file.
  83.  
  84. Examples
  85.  
  86. To disable DCon function calls in a single file:
  87.      #define DCON 0
  88.      #include "DCon.h"
  89.  
  90.  
  91.  
  92.  
  93.  
  94. Macro - dAssert
  95.  
  96.      dAssert(conditional_expression)
  97.  
  98. Description
  99.  
  100. The dAssert macro prints an error message to the console window if the conditional_expression is false  (i.e., compares equal to zero).  The dAssert macro uses the dprintf function to output and is subject to the redirection effects of the dopen function.  The dAssert macro only generates runtime code when the DCON macro is defined to be 1.
  101.  
  102. Examples
  103.  
  104. To generate an error message when a pointer argument is unexpectedly NULL:
  105.      void Foo(const char *bar) {
  106.         dAssert(bar != NULL);
  107.  
  108.